var wrap = $("#wrapper,#wrapper2"), ww = window.innerWidth, wh = window.innerHeight, oneH = !1;
function changeScene(e) {
    ww = window.innerWidth, wh = window.innerHeight, console.log("width:" + window.innerWidth, "height:" + window.innerHeight), wh < ww ? (console.log("浏览器的宽度大于高度"), "one" == e && (oneH = !0), 640 * ww / 1e3, $("body").css({
        width: ww + "px",
        height: wh + "px"
    }), wrap.css({
        width: ww + "px",
        height: wh + "px",
        transform: "translate3d(-50%,-50%,0)",
        "-webkit-transform": "translate3d(-50%,-50%,0)"
    }), $("#video").css({
        width: "100%",
        height: "auto"
    })) : ww <= wh && (console.log("浏览器的宽度小于高度"), 1 == oneH && location.reload(), 720 * wh / 1e3, $("body").css({
        width: ww + "px",
        height: wh + "px"
    }), $("#video").css({ width: "auto", height: "100%" }), wrap.css({
        width: wh + "px",
        height: ww + "px",
        transform: "translate3d(-50%,-50%,0) rotate(90deg)",
        "-webkit-transform": "translate3d(-50%,-50%,0) rotate(90deg)"
    }))


}
$("body").css({ width: ww + "px", height: wh + "px" }), changeScene("one"), window.onresize = function () {
    setTimeout(function () {
        changeScene()
    }, 100)
};
var PROJECT = PROJECT || {}, isH;
function setVH(e) {
    var i;
    1 == (isH = null == e || e) ? ((i = document.createElement("div")).id = "landscape", i.className = "horizontal") : ((i = document.createElement("div")).id = "landscape", i.className = "vertical"), document.body.appendChild(i)
}
PROJECT.adaptiveModel = "topLeft", PROJECT.stageWidth = 0, PROJECT.stageHeight = 0, PROJECT.stage = null, PROJECT.canvas = null, PROJECT.renderer = null, PROJECT.SCENE_IN = "sceneIn", PROJECT.SCENE_OUT = "sceneOut", PROJECT.SCENE_IN_COMPLETE = "sceneInComplete", PROJECT.SCENE_OUT_COMPLETE = "sceneOutComplete", PROJECT.ON_ENTER_FRAME = "onEnterFrame", PROJECT.GO_SCENE3 = "goScene3", PROJECT.retinaSupport = !0, PROJECT.imageScale = 1, PROJECT.positionScale = 1, PROJECT.Utils = PROJECT.Utils || {}, PROJECT.Utils.inherit = function (e, i) {
    e.superClass = i, e.prototype = Object.create(i.prototype), e.prototype.constructor = e
}, PROJECT.Utils.extend = function (e, i) {
    if (!i || "object" != typeof i) return e;
    for (var n = Object.keys(i), t = n.length; t--;)e[n[t]] = i[n[t]];
    return e
}, PROJECT.Utils.isAndroid = function () {
    for (var e = navigator.userAgent, i = new Array("Android", "SymbianOS", "Windows Phone"), n = !1, t = 0; t < i.length; t++)if (0 < e.indexOf(i[t])) {
        n = !0;
        break
    }
    return n
}, PROJECT.Utils.isM2 = function () {
    var e = !1;
    return 0 < navigator.userAgent.indexOf("m2") && (e = !0), e
}, PROJECT.Event = function (e) {
    this.type = e, this.target = null
}, PROJECT.Event.prototype = {
    constructor: PROJECT.Event, clone: function () {
        return new PROJECT.Event(this.type, this.target)
    }
}, PROJECT.EventDispatcher = function () {
}, PROJECT.EventDispatcher.prototype = {
    constructor: PROJECT.EventDispatcher, apply: function (e) {
        e.addEventListener = PROJECT.EventDispatcher.prototype.addEventListener, e.removeEventListener = PROJECT.EventDispatcher.prototype.removeEventListener, e.removeAllEventListeners = PROJECT.EventDispatcher.prototype.removeAllEventListeners, e.dispatchEvent = PROJECT.EventDispatcher.prototype.dispatchEvent, e.on = PROJECT.EventDispatcher.prototype.addEventListener, e.once = PROJECT.EventDispatcher.prototype.once
    }, addEventListener: function (e, i) {
        void 0 === this._listeners && (this._listeners = {});
        var n = this._listeners;
        void 0 === n[e] && (n[e] = []), -1 === n[e].indexOf(i) && n[e].push(i)
    }, dispatchEvent: function (e) {
        if (void 0 !== this._listeners) {
            var i = this._listeners[e.type];
            if (null != i) {
                e.target = this;
                for (var n = i.slice(), t = 0, a = n.length; t < a; t++)n[t].call(this, e)
            }
        }
    }, removeEventListener: function (e, i) {
        if (void 0 !== this._listeners) {
            var n = this._listeners, t = n[e].indexOf(i);
            -1 !== t && n[e].splice(t, 1)
        }
    }, removeAllEventListeners: function () {
        if (void 0 !== this._listeners) {
            var e = this._listeners;
            for (var i in e) delete e[i]
        }
    }
}, PROJECT.EventDispatcher.prototype.on = PROJECT.EventDispatcher.prototype.addEventListener, PROJECT.EventDispatcher.prototype.once = function (n, t) {
    this.addEventListener(n, function e(i) {
        this.removeEventListener(n, e), t.call(this, i)
    })
}, setVH(!0);




var initFlag = !0, landscape = !1;
function orien() {
    1 == isH ? 90 == window.orientation || -90 == window.orientation ? (initFlag && (initFlag = !1, landscape = !0), $("#landscape").show()) : ($("#landscape").hide(), landscape ? location.href = "index.php?r=" + Math.random() : initFlag && (initFlag = !1)) : 0 == window.orientation || 180 == window.orientation ? (initFlag && (initFlag = !1, landscape = !0), $("#landscape").show()) : ($("#landscape").hide(), landscape ? location.href = "index.php?r=" + Math.random() : initFlag && (initFlag = !1))
}
orien(), $(window).on("orientationchange", orien);
var isAndroid = "android" == navigator.userAgent.toLowerCase().match(/android/i), isSafari = (/iPhone/i.test(navigator.platform) || /iPod/i.test(navigator.platform) || /iPad/i.test(navigator.userAgent)) && !!navigator.appVersion.match(/(?:Version\/)([\w\._]+)/), ua = navigator.userAgent, musicWX = /MicroMessenger/i.test(ua), ios = /iPad|iPhone|iPod/.test(navigator.platform) || 0 <= ua.indexOf("iphone"), QB, WeiXin = !1;
function IsPC() {
    for (var e = navigator.userAgent, i = new Array("Android", "iPhone", "SymbianOS", "Windows Phone", "iPad", "iPod"), n = !0, t = 0; t < i.length; t++)if (0 < e.indexOf(i[t])) {
        n = !1;
        break
    }
    return n
}
(-1 < ua.indexOf("mttcustomua") || -1 < ua.indexOf("mqqbrowser")) && (QB = !0), -1 < ua.indexOf("micromessenger") && (WeiXin = !0);
var ispc = IsPC();
function GetQueryString(e) {
    var i = new RegExp("(^|&)" + e + "=([^&]*)(&|$)"), n = window.location.search.substr(1).match(i);
    return null != n ? unescape(n[2]) : null
}

var src = "";

var Gyro = function () {
    var a = !1, o = Math.PI / 180, r = {}, l = null;

    function e(e) {
        var i, n, t;
        0 != a && (i = (r = e).alpha, n = r.beta, t = r.gamma, l && l({
            alpha: i,
            beta: n,
            gamma: t,
            degAlpha: i * o,
            degBeta: n * o,
            degGamma: t * o
        }))
    }

    return function () {
        window.addEventListener("deviceorientation", e, !1), this.init = function (e) {
            e && (l = e)
        }, this.openDevice = function () {
            a = !0
        }, this.closeDevice = function () {
            a = !1
        }
    }
}();


var video = document.getElementById("video");


function initVideo() {

    video.addEventListener("play", videoPlayHandler), video.addEventListener("ended", videoEnd), video.addEventListener("pause", videoPause), $("#btn_close").on("touchend", function () {
        closeVideo()
    })
    //    , $("#btn_skip").on("touchend", function () {
    //    closeVideo()
    //}), $("#btn_pause").on("touchend", function () {
    //    $("#btn_pause").hide(), isLunchVideo ? video.play() : thisVideoDom.play()
    //}), $(".videoBox").on("touchend", function () {
    //    isBtnCloseShow ? (isBtnCloseShow = !1, isLunchVideo && $("#btn_skip").hide()) : (isBtnCloseShow = !0, isLunchVideo && $("#btn_skip").show())
    //})




}
// initVideo()
function videoPlayHandler() {


    //$("#btn_pause").hide(), setTimeout(function () {
    //    lunch && (containerH.removeChild(lunch), lunch = null), null == kv && kvIn()
    //}, 500)
}
function videoPause() {
    console.log(":::::::::::pause"), $("#btn_pause").show()
}
function videoEnd() {
    console.log("播放结束")

    $(".end").show(), $("#video").remove(), $(".videoBox").hide()

    $("#end-btn1").off().on("click", function () {
        alert("再看一次")
    })
    $("#end-btn2").off().on("click", function () {
        alert("和好友一起看")
    })


}
function playVideo() {



    $("#video").show(), $("#wrapper").show(), video.play(), document.getElementById("audio").pause(), $(".page1").addClass("active")
}


